const sequelize = require("./db");
const { DataTypes } = require("sequelize");


const Book = sequelize.define(
    "Book",
    {
        name: {
            type: DataTypes.STRING,
            allowNull: false,
        },
        imgUrl: {
            type: DataTypes.STRING
        },
        publishDate: {
            type: DataTypes.STRING,
            allowNull: false,
        },
        author: {
            type: DataTypes.STRING,
            allowNull: false,
        }
    },
    {
        createdAt: 'create_time',
        updatedAt: 'update_time',
        paranoid: true,
    }
);

// const books = [
//     {
//         name: '鹿川有许多粪',
//         imgUrl: 'https://img2.doubanio.com/view/subject/s/public/s33968312.jpg',
//         publishDate: '2021-8',
//         author: '李沧东'
//     }
// ]

// Book.bulkCreate(books);

module.exports = Book